﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using IdeaNMR.Web.Core;
using System.Text.RegularExpressions;

namespace IdeaNMR.Web
{
    public partial class ScriptsTable : ListNMRObjects_BaseTable<Script>
    {
        protected override Item[] FilterRawData()
        {
            IEnumerable<Item> result = base.FilterRawData();

            if (this.SearchTerms.Length > 0)
            {
                var res1 = from r in this.RawData
                           where
                              Regex.IsMatch(r.Obj.Type.ToLowerInvariant(), this.SearchRegEx)
                           select r;
                result = result.Union(res1);
            }

            return result.ToArray();
        }
    }
}